Repository navigation
fix(aggregator): body amount fallback — standalone total, paid labels win (#3121) - #3164
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 10 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #3121 (Codex P2 from PR #2149, comment 4409381673, merged undispositioned).
The Gmail body-amount fallback regex had
totalas an unbounded alternative, so it matched the "total" inside "Subtotal": a bodySubtotal $20.00 / Tax $1.60 / Total $21.60recorded $20.00, and since exec() takes the first match, a laterAmount paid $21.60never won. The wrong amount also defeats cross-source dedupe.Change (
pm-stack/aggregator/scripts/produce-charge-candidates.ts):amountFromBody(): explicit paid/charged labels (amount paid | amount charged | total charged | transaction amount) win first; a standalone\btotallabel is next (word boundary — "Subtotal" cannot match); any $ amount remains the last-resort fallback, as before.main()is now behindimport.meta.mainso the script is importable by tests without running the producer.Tests (
test/produce-charge-candidates.test.ts, new): Subtotal/Tax/Total + later Amount paid records 21.60; later Amount paid beats an earlier bare Total; standalone Total used when no paid label exists; total charged counts as paid/charged; no-amount body yields undefined. 5/5 pass on the laptop. Full aggregator suite: 712 pass / 7 fail — the 7 (page-manifest/nav renders) fail identically on clean origin/main in the same environment (verified via stash), pre-existing and unrelated.Queue task 4554.
Need help on this PR? Tag
@codesmith-botwith what you need.